class Solution(object):
    def missingNumber(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        nums.sort()

        for (i, n) in enumerate(nums):
            if i != n:
                return i

        return len(nums)

s = Solution()
print(s.missingNumber([1, 2]))
print(s.missingNumber([0]))
print(s.missingNumber([3,0,1]))
print(s.missingNumber([9,6,4,2,3,5,7,0,1]))
print(s.missingNumber([0, 2]))
print(s.missingNumber([0, 1]))